unit FormSelectClient;

interface

uses
    Windows,
    Messages,
    SysUtils,
    Variants,
    Classes,
    Graphics,
    Controls,
    Forms,
    Dialogs,
    FrameClients,
    ExtCtrls,
    StdCtrls;

type
    TfrmSelectClient = class(TForm)
        Panel1: TPanel;
        Panel2: TPanel;
        bClose: TButton;
        bSelect: TButton;
        procedure bCloseClick(Sender: TObject);
        procedure bSelectClick(Sender: TObject);
    private
        procedure OnDblClick(Sender: TObject);
    public
        frmeClients: TfrmeClients;
        pClientId: integer;
        constructor Create(AOwner: TComponent); reintroduce;
        destructor Destroy; override;
        { Public declarations }
    end;

var
    frmSelectClient: TfrmSelectClient;

implementation

{$R *.dfm}

procedure TfrmSelectClient.bCloseClick(Sender: TObject);
begin
    pClientId := 0;
    Close;
end;

procedure TfrmSelectClient.bSelectClick(Sender: TObject);
begin
    pClientId := frmeClients.qClients.FieldByName('id_client').AsInteger;
    Close;
end;

constructor TfrmSelectClient.Create(AOwner: TComponent);
begin
    inherited;
    frmeClients := TfrmeClients.Create(self);
    frmeClients.Parent := self;
    frmeClients.cxgClientsDBTableView1.OnDblClick := OnDblClick;
end;

procedure TfrmSelectClient.OnDblClick(Sender: TObject);
begin
    bSelect.Click;
end;

destructor TfrmSelectClient.destroy;
begin
    frmeClients.Parent := nil;
    frmeClients.free;
    frmeClients := nil;
    inherited;
end;

end.

